package org.example.diary.enums;

import lombok.Getter;
import org.example.diary.exceptions.SystemErrorCode;

/**
 * 业务错误码定义
 */
@Getter
public enum BizErrorCode implements SystemErrorCode {

    REQUEST_NO_SUPPORT(405, "请求方法不支持"),
    NO_PERMISSIONS(403, "暂无权限,请联系管理员"),
    UNSUPPORTED_MEDIA_TYPE(415, "服务器无法处理请求附带的媒体格式"),
    ILLEGAL_PARAM(450, "请求参数不合法"),
    INTERNAL_ERROR(500, "系统繁忙"),
    NO_LOGIN(505, "未登录"),
    TIMEOUT(504, "请求超时"),
    SQL_ERROR(508, "数据库操作异常"),
    INVALID_API_KEY(535, "无效的请求凭证"),
    DATA_NOT_EXIST(542,"数据不存在"),
    USER_USERNAME_EXIST(10010,"用户名已存在"),
    LOGIN_FORBID(10026,"用户名或密码错误，请修改后重试"),
    USER_NOT_EXISTS(10002,"用户不存在"),
    USER_ROLE_NULL(10017,"用户角色校验失败"),
    ;

    /**
     * 错误码
     */
    private int code;

    /**
     * 错误描述
     */
    private String message;


    BizErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public BizErrorCode setMessage(String message) {
        this.message = message;
        return this;
    }

}
